import turtle

# 定义一些表示特殊值的变量
RING_RADIUS = 40  # 环的半径
SPACE_BETWEEN_RINGS = 8  # 环之间的间隔
START_X = -150  # 第一个环的起始X坐标
START_Y = 0  # 所有环的Y坐标
COLORS = ["blue", "black", "red", "yellow", "green"]  # 奥林匹克五环的颜色
ARC_ANGLE = 225  # 弧线的角度
ARC_START_ANGLE = [90, 90, 90, 90, 90]  # 每个弧线的起始角度

# 设置窗口大小
turtle.setup(800, 600)
window = turtle.Screen()
window.title("Olympic Rings")

# 创建一个Turtle对象
pen = turtle.Turtle()
pen.speed(0)  # 最快速度绘制
pen.hideturtle()  # 隐藏海龟图标

# 绘制五个环
for i in range(5):
    # 移动到指定位置
    pen.penup()
    pen.goto(START_X + (i * (RING_RADIUS * 2 + SPACE_BETWEEN_RINGS)), START_Y)
    pen.pendown()

    # 设置颜色
    pen.color(COLORS[i], "white")  # 设置描边颜色和填充颜色（这里不填充）
    pen.begin_fill()

    # 绘制圆形
    pen.circle(RING_RADIUS)

    pen.end_fill()

# 绘制四个弧线以连接环
for i in [0, 1, 2, 4]:
    pen.penup()
    pen.goto(START_X + (i * (RING_RADIUS * 2 + SPACE_BETWEEN_RINGS)) + RING_RADIUS, START_Y + RING_RADIUS)
    pen.setheading(ARC_START_ANGLE[i])
    pen.pendown()
    pen.circle(RING_RADIUS, ARC_ANGLE)

# 保持窗口打开直到用户关闭
turtle.done()